#ifndef __RPLIDAR_H
#define __RPLIDAR_H
#include "main.h"
#include "stm32f1xx_hal.h"
#define LIDAR_LOOP_NUM 5
#define LIDAR_DEGREE 361
typedef struct
{
	uint16_t obstacle[5][361];
	uint8_t numOfCollection;

}Lidar_Type;

void UART2_Printf(const char* format,...);
uint8_t RPLIDAR_ROTATION_START(void);
uint8_t RPLIDAR_SCAN_START(uint8_t uart_order,Lidar_Type *lidar);
uint8_t RPLIDAR_SCAN_Stop(uint8_t uart_order,Lidar_Type *lidar);
uint8_t RPLIDAR_RESTARTSCAN(uint8_t uart_order,Lidar_Type *lidar);
uint8_t collect_LIDARdata(uint8_t uart_order,Lidar_Type *lidar);
uint8_t Detect_Obstacles(Lidar_Type *lidar,int16_t Min_X,int16_t Max_X,int16_t Min_Y,int16_t Max_Y,uint16_t Detect_Angle);
int16_t Get_Distance(Lidar_Type *lidar,uint16_t angle);
uint8_t isReceiveOvertime(uint8_t uart_order);
void Start_Receive_lidardata(uint8_t uart_order);
void Get_ScanData(uint8_t uart_order);


#endif



